package com.error;

import com.error.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

import static com.error.ResponseCodeEnum.OPERATE_FAIL;

/**
 * @Auther: zwg
 * @Date: 2019/3/5 09:15
 * @Description:
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/error")
    public ResponseResultVO<Object> errorTest(){
        try{
            throw new UserException(OPERATE_FAIL);
        }catch (UserException e){
            throw e;
        }
    }

    @GetMapping("/getUserInfo")
    public ResponseResultVO<Object> getUserInfo(@RequestParam Integer userId){
        userInfoService.getUserName(userId);
        return null;
    }
}
